﻿using Magicodes.ExporterAndImporter.Excel.AspNetCore;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using NP.BPMReportPlatform.Entities.BPM_Business;
using NP.BPMReportPlatform.HandInvoice.Dto;
using NP.BPMReportPlatform.SWSendMail.Dto;
using NP.BPMReportPlatform.TaxManage.Dto;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp;
using Volo.Abp.Application.Dtos;
using Volo.Abp.ObjectMapping;

namespace NP.BPMReportPlatform.SWSendMail
{
    /// <summary>
    /// 数电发票查询
    /// </summary>
   // [Authorize]
    [ApiController]
    [Route("api/SWSendMail/")]
    public class SWSendMailController : BPMReportPlatformController
    {       
        private ISWSendMailService _swSendMailService;
        public SWSendMailController(ISWSendMailService sWSendMailService)
        {

            _swSendMailService = sWSendMailService;
        }

        /// <summary>
        /// 查询
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        [Route("QueryAsync")]
        public async Task<PagedResultDto<SearchOutPutDto>> GetAllAsync([FromBody] SearchInputDto input)
        {

            return await _swSendMailService.GetAllAsync(input);
        }

        /// <summary>
        /// 见单生产导出数据
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        [Route("ExportAsync")]
        public async Task<XlsxFileResult<SearchOutPutDto>> ExportAsync([FromBody] SearchInputDto input)
        {
            var rst = await _swSendMailService.ExportAsync(input);
            return new XlsxFileResult<SearchOutPutDto>(rst, "导出Excel");
        }
    }
}
